{{include template('public/header','admin')}}
</head>
<body>
    <div class="container">
        <div style="margin: 20px;">
            <form class="form-horizontal" role="form" action="{{url($postUrl)}}" method="post"  id="cpform" name="cpform"  onsubmit="return dosub(this)" >
                <input type='hidden' name='urlruleid' value="{{$item['urlruleid']}}" />
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label">{{L('urlrule_name')}}</label>
                    <div class="col-sm-10 form-inline">
                        <input type="text" id="name" name='name' value="{{$item.name}}" maxlength="50" tabindex="2" class='form-control' style="width: 500px;" />
                        <span class="help-block">给它起一个描述名称</span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="urlrule" class="col-sm-2 control-label">{{L('urlrule_urlrule')}}</label>
                    <div class="col-sm-10 form-inline">
                        <input type="text" id="urlrule" name='urlrule' value="{{$item.urlrule}}" maxlength="100" tabindex="3" class='form-control' style="width: 500px;"/>
                        <span class="help-block">如：mylist/(\d+)，“(\d+)”表示匹配数字，支持的特殊符号有：<span style="color: red;">~!@</span></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="route" class="col-sm-2 control-label">{{L('urlrule_route')}}</label>
                    <div class="col-sm-10 form-inline">
                        <input type="text" id="route" name='route' value="{{$item.route}}" maxlength="100" tabindex="4" class='form-control' style="width: 500px;"/>
                        <span class="help-block">如：对应上面的例子：模块/控制器/方法/参数1/$1<br>
                            URL规则：模块/控制器/方法/参数1/$1/参数2/$2...<span style="color: red;">（$1,$2为规则中匹配到的动态值）</span></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type='submit' name='dosubmit' class='btn  btn-default' value='{{L('submit')}}' />
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        function dosub(obj) {
            $.ajax({
                type: 'POST',
                url: '{{url($postUrl)}}',
                data: $(obj).serialize(),
                dataType: "json",
                success: function (ret) {
                    if (ret.status=="y") {
                        parent.location.reload();
                    } else {
                        layer.msg(ret.info);
                    }
                }
            });
            return false;
        }
    </script>
</body>
</html>